cmake_minimum_required(VERSION 2.6)

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} 
    "${CMAKE_SOURCE_DIR}/cmake/Modules/")

project(WebPlodder)

add_definitions(-DDEBUG)

find_package(Boost 1.42 REQUIRED COMPONENTS filesystem regex program_options
             system)

find_package(PkgConfig REQUIRED)
pkg_search_module(YAMLCPP REQUIRED yaml-cpp)

include_directories(${Boost_INCLUDE_DIRS}
                    ${YAMLCPP_INCLUDE_DIRS})
link_directories(${YAMLCPP_LIB_DIRS}
                 ${Boost_LIB_DIRS})

set(SRC src/webplodder/plodder.cpp
    src/webplodder/templatefile/file.cpp
    src/webplodder/templatefile/commandelement.cpp
    src/webplodder/templatefile/scriptelement.cpp
    src/webplodder/templatefile/element.cpp
    src/webplodder/templatefile/varelement.cpp
    src/webplodder/templatefile/textelement.cpp
    src/webplodder/main.cpp
    src/webplodder/processor.cpp
    src/webplodder/plugin.cpp
    src/webplodder/pluginmanager.cpp
    src/webplodder/syntaxerror.cpp
    src/webplodder/page.cpp
    src/webplodder/templatefile/parser.cpp
    src/webplodder/utils/citerator.cpp
    src/webplodder/types/object.cpp
    src/webplodder/types/integer.cpp
    src/webplodder/types/float.cpp
    src/webplodder/navigation/node.cpp
    src/webplodder/process/popen2.cpp
    src/webplodder/process/process.cpp
    src/webplodder/utils/comparenodes.cpp
    src/webplodder/utils/regexitermatch.cpp)

add_executable(webplodder ${SRC})
set_target_properties(webplodder PROPERTIES
                      COMPILE_FLAGS "-Wall")

target_link_libraries(webplodder ${Boost_LIBRARIES}
                              ${YAMLCPP_LIBRARIES}
                              dl)

install(TARGETS webplodder DESTINATION bin)
install(FILES "${PROJECT_SOURCE_DIR}/src/webplodder/pluginobject.hpp"
        DESTINATION "include/webplodder")
